/*
 * @Description: 当设备物理像素为750时，1rem===32px
 * @Author: dh
 * @Date: 2022-04-12 09:21:21
 * @LastEditors: dh
 * @LastEditTime: 2022-11-09 15:14:54
 */

const baseSize = 16;

function setRem() {
	// 实际设备页面宽度和设计稿的比值
	const scale = document.documentElement.clientWidth / 1920;
	// 计算实际的rem值并赋予给html的font-size
	document.documentElement.style.fontSize = baseSize * scale + "px";
	//   document.documentElement.style.fontSize = (baseSize * Math.min(scale, 2)) + 'px'
}
setRem();
window.addEventListener("resize", () => {
	setRem();
});
